{% extends "base.html" %}
{% block content %}

<div id="wip_data">

{% if people %}
<table class="leaderboard">
    <caption>{{ start }} through {{ end }}</caption>
    <tr>
        <th>Person</th>
        <th>Cards done</th>
        <th>Cards/month</th>
        <th>Ave. cycle time</th>
    </tr>

    {% for p in people %}
    <tr>
        <td><a href="{{ url_for('report_leaderboard', group=group, months=months, person=p.name, start_month=start_month, start_year=start_year,) }}">{{ p.name }}</a></td>

        <td>{{ p.cards|length }}</td>

        <td>{{ "%.1f"|format(p.cards|length/months) }}</td>

        <td>{{ p.cycle_time }}</td>
    </tr>
    {% endfor %}
</table>

{% elif person %}

{% import "card_macros.html" as card_macros %}
{% set caption = "%s: Cards completed from %s through %s" % (person.name, start, end) %}
{{ card_macros.card_table(person.sorted_cards, request, caption=caption, show_done=True, show_assigned=False, show_state=False, show_in_goal=True) }}

{% set caption = "%s: Defects fixed from %s through %s" % (person.name, start, end) %}
{{ card_macros.card_table(person.sorted_defects, request, caption=caption, show_done=True, show_assigned=False, show_state=False, show_in_goal=True) }}


{% else %}
    No data available.
{% endif %}


</div>

{% endblock content %}
